package redis

import (
	"fmt"
	"github.com/go-redis/redis"
	"zc2/appconfig"
)

var Client *redis.Client

func RedisInit() {
	appConfig := appconfig.AppConfig.Redis
	Client = redis.NewClient(&redis.Options{
		Addr:     appConfig.Addr,
		Password: appConfig.Password,
		DB:       appConfig.DB,
	})

	pong, err := Client.Ping().Result()
	fmt.Println(pong, err)
	if err != nil {
		fmt.Println("redis连接失败")
	} else {
		fmt.Println("redis连接成功")
	}
}
